<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ page import="managesystem.Student" %>
<!DOCTYPE html>
<html> 
   <head>
      <meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1">
      <title>Account ||Distractions</title> 
      <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.min.js"></script>
      <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" />
      <script src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>
	  
	  
      <%
      	session.setAttribute("fromMobile","true");
   		Student currStud = (Student) session.getAttribute("currStud");
  		if(currStud == null){
  			response.sendRedirect("../index-mobile.jsp");
  		}
  		
   	  %>
   </head> 
	<body> 
		<div data-role="page" id="distractions">
						<div data-role="header" data-theme="b">
							<h1>Account || Distractions</h1>
							<a href="/index-mobile.jsp" data-icon="home" data-ajax="false" data-iconpos="notext" data-direction="reverse" class="ui-btn-left jqm-home">Home</a>
							<a href="#addDistraction" data-icon="plus" class="ui-btn-right" data-rel="dialog">New Distraction</a>
						</div>
					
						<div data-role="content" data-theme="b">
						<p>This is a list of distractions that you experience during your study. These will be displayed as an option during tracking.</p>	
							
							<%
								
								String[] distractions = currStud.getDistractions();
								if(distractions.length !=0){
								%>
									<ul data-role="listview" data-filter="true">
								<%
							  	for(String d : distractions){
							  		%>	
							  			
							  				<li><%=d%></li>
							  			
							  		<%
							  	}
								%></ul><%
								}else{
								%>
									<p style="color:red;">No distractions are related to this account.</p>
								<%
								}
							%>
								
							
						</div>
						<div data-role="footer" data-theme="b">
							<p align="center">Logged in as : <%=currStud.getUsername() %></p>
						</div>
				  	</div>
	</body>
	<div data-role="page" id="addDistraction">
						<div data-role="header" data-theme="b">
							<h1>Distractions || Add a new distraction</h1>
						</div>
					
						<div data-role="content" data-theme="b">
						<form action="/addDistraction" method="post">
						<div data-role="fieldcontain">
						    <label for="distraction">Aid tool:</label>
						    <input type="text" name="distraction" id="distraction" value="" placeholder="Type a new distraction"/>
						    <input type="submit" value="Add distraction"  />
						</div>
						</form>	
						</div>
						<div data-role="footer" data-theme="b">
							<p align="center">Logged in as : <%=currStud.getUsername() %></p>
						</div>
				  	</div>
	</body>
</html>